package com.bsdsma.fengheguaiapp.utils;

import java.util.HashMap;
import java.util.Map;

public class ResultUtils {

    public static Map<String, Object> ok(Object data){
        Map<String, Object> map = new HashMap<>(4);
        map.put("success", true);
        map.put("code", "0");
        map.put("msg", "操作成功");
        map.put("data", data);
        return map;
    }

    public static Map<String, Object> ok(){
        Map<String, Object> map = new HashMap<>(4);
        map.put("success", true);
        map.put("code", "0");
        map.put("msg", "操作成功");
        return map;
    }

    public static Map<String, Object> failed(String msg){
        return failed("-1", msg);
    }

    public static Map<String, Object> failed(String code, String msg){
        Map<String, Object> map = new HashMap<>(4);
        map.put("success", false);
        map.put("code", code);
        map.put("msg", msg);
        return map;
    }
}
